using Dew.Math;
using Dew.Math.Editors;
using Dew.Math.Units;
using Dew.Signal;
using Dew.Signal.Units;
using Dew.Math.Tee;
using Dew.Signal.Tee;
private void button1_Click(
object sender, EventArgs e)
{
Vector h =
new Vector(0);
Vector b =
MtxExpr.Ramp(300, TMtxFloatPrecision.mvDouble, 0, 0.1);
Vector c =
new Vector(b.Length);
TFirState state =
new TFirState();
int n = 10;
int i;
SignalUtils.SavGolayImpulse(h,15,7,
null);
SignalUtils.FirInit(h,
ref state,1,0,1,0);
try
{
c.Size(b);
n = 10;
int bLength = b.Length;
//must be outside of the "for" to prevent reevaluation
for (i = 0; i < (bLength/n); i++)
{
b.SetSubRange(i * n, n);
//select only a small subvector of the vector
c.SetSubRange(i * n, n);
SignalUtils.FirFilter(b,c,
ref state);
}
MtxVecTee.DrawIt(
new TVec[2] { b, c },
new string[2] { "Filtered data", "Original data" }, "Savitzky Golay",
false);
}
finally
{
SignalUtils.FirFree(
ref state);
}
}